/*  
 *  Program.cs - Entry point to the application
 *  Copyright(c) 2007 Adam W Adair
 *
 *  This file is part of Adam's Chess Engine (ACE).
 *
 *  ACE is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *   
 *  ACE is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with ACE; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace ACE
{
    /// <summary>
    /// Program is just the entry point for the application.  It creates an instance of 
    /// AceConsole and runs it.
    /// </summary>
    class Program
    {
        public const string NAME = "Adam's Chess Engine (ACE)";
        public const string VERSION = "0.1";
        public const string VERSION_DATE = "01/24/2007";
        public const string COPYRIGHT = "Copyright (c) 2007 Adam Adair";
        public static bool IsDebug = false;

        static void Main(string[] args)
        {
            for (int i = 0; i < args.Length; ++i)
            {
                if (args[i] == "--version")
                {
                    DisplayLongVersion();
                    System.Environment.Exit(0);
                }
                if (args[i] == "--debug")
                {
                    IsDebug = true;
                    // Make sure the default logger logs everything
                    Log.DefaultLogLevel = Log.LogLevel.LOG_ERROR | Log.LogLevel.LOG_WARNING |
                                        Log.LogLevel.LOG_INFO | Log.LogLevel.LOG_DEBUG;
                }
            }
            DisplayShortVersion();
            ACEConsole console = new ACEConsole();
            console.RunMeSomeMoreHey();

        }

        private static void DisplayShortVersion()
        {
            System.Console.Out.WriteLine(NAME + "\nVersion " + VERSION + " (" + VERSION_DATE + ")\n" + COPYRIGHT);
            if (IsDebug) Console.WriteLine("Debug mode is on.");
        }

        private static void DisplayLongVersion()
        {
            System.Console.Out.WriteLine(NAME + "\n" + VERSION + "(" + VERSION_DATE + ")\n" + COPYRIGHT+"\n");
            System.Console.Out.WriteLine("THIS IS FREE SOFTWARE\n");
        }
    }
}
